<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="noticeList" highlight-current-row @current-change="handleCurrentChange">
      <el-table-column label="序号" align="center" prop="index" width="60" type="index"/>
      <el-table-column label="设备编号" align="center" prop="equipNo" show-overflow-tooltip/>
      <el-table-column label="设备名称" align="center" prop="equipMent" width="150" show-overflow-tooltip/>
      <el-table-column label="品牌" align="center" prop="brand" show-overflow-tooltip/>
      <el-table-column label="负责人" align="center" prop="leader" show-overflow-tooltip/>
      <el-table-column label="项目名称" align="center" prop="itemName" width="150" show-overflow-tooltip/>
      <el-table-column label="数量" align="center" prop="number" show-overflow-tooltip/>
      <el-table-column label="地址" align="center" prop="area" show-overflow-tooltip />
    </el-table>
  </div>
</template>

<script setup name="Notice">
import { equipmentList } from "@/api/system/procurement.js"

const {proxy} = getCurrentInstance()

const noticeList = ref([])
const loading = ref(true)
const title = ref("")
const currentRow = ref()

const data = reactive({
  queryParams: {
    id:'BG091890'
  },
})

const { queryParams } = toRefs(data)

//表格单选
const handleCurrentChange = (val) => {
  currentRow.value = val
  console.log(currentRow.value)
}

/** 查询公告列表 */
function getList(v) {
  loading.value = true
  equipmentList({id:v}).then(response => {
    if(response.data){
      noticeList.value.push(response.data)
      loading.value = false
    }else{
      loading.value = false
    }
  }).catch((err)=>{
    console.log(err)
    loading.value = false
  })
}

//暴露给父组件的属性
defineExpose({currentRow,getList})

// getList()
</script>
